//
//  SubView.m
//  10103-九宫格
//
//  Created by student on 16/2/27.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "SubView.h"

@interface SubView()

@end

@implementation SubView

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        UIImageView *imageView1 = [[UIImageView alloc] init];
        [self addSubview:imageView1];
        self.imageView1 = imageView1;
        UILabel *label1 = [[UILabel alloc] init];
        [self addSubview:label1];
        self.label1 = label1;
        UILabel *label2= [[UILabel alloc] init];
        [self addSubview:label2];
        self.label2 = label2;
        UIImageView *imageView2 = [[UIImageView alloc] init];
        [self addSubview:imageView2];
        self.imageView2 = imageView2;
    }
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    int width = self.frame.size.width;
    int height = self.frame.size.height;
    
    self.imageView1.frame = CGRectMake(0, 0, width, height-40);
    self.imageView2.frame = CGRectMake(width-30, height-30, 30, 30);
    self.label1.frame = CGRectMake(0, height-40, width-40, 15);
    self.label2.frame = CGRectMake(0, height-20, width-40, 15);
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
